/*
 * FramePrincipal.java
 *
 * Created on 21 de mayo de 2009, 21:28
 */

package GUI;

import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;



/**
 *
 * @author  David
 */
public class Main extends javax.swing.JFrame {

    /** Creates new form FramePrincipal */
    public Main() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel_EscojaPregunta = new javax.swing.JLabel();
        jComboBox_Preguntas = new javax.swing.JComboBox();
        jButton_Asesorar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel_EscojaPregunta.setText("Escoja Pregunta :");

        jComboBox_Preguntas.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Asesoramiento jurídico", "Asesoramiento Técnico", "Asesoramiento Afectivo" }));

        jButton_Asesorar.setText("Asesorar");
        jButton_Asesorar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_AsesorarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(154, 154, 154)
                        .addComponent(jButton_Asesorar))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(54, 54, 54)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel_EscojaPregunta, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jComboBox_Preguntas, javax.swing.GroupLayout.PREFERRED_SIZE, 301, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(45, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addComponent(jLabel_EscojaPregunta)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jComboBox_Preguntas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(72, 72, 72)
                .addComponent(jButton_Asesorar)
                .addContainerGap(118, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButton_AsesorarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AsesorarActionPerformed
    int indice =jComboBox_Preguntas.getSelectedIndex();
    JFrame fr;
    switch ( indice ) {
      case 0:
           
           this.setVisible(false);
        try {
            fr = new FramePreguntaJuridico(this);
        } catch (FileNotFoundException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
           
           break;
      case 1:
           this.setVisible(false);
           fr = new FramePreguntasTecnico(this);
       
           break;
        case 2:
           this.setVisible(false);
           fr = new FramePreguntasAfectivo(this);
           break;
      default:
           System.out.println("error" );
           break;
      }

    
}//GEN-LAST:event_jButton_AsesorarActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                 new Main().setVisible(true);
        try {
               FileWriter fw = new FileWriter("C://salida.txt");
               BufferedWriter bw = new BufferedWriter(fw);
               PrintWriter salida = new PrintWriter(bw);
               salida.close();
        }
               catch(java.io.IOException ioex) {
               System.out.println("se presento el error: "+ioex.toString());
        }
     
                
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton_Asesorar;
    private javax.swing.JComboBox jComboBox_Preguntas;
    private javax.swing.JLabel jLabel_EscojaPregunta;
    // End of variables declaration//GEN-END:variables

}
